<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- 引入 Bootstrap -->
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
<script type="text/javascript" src="/ulms_project/js/jquery-3.3.1.min.js"></script>
<title>报修进度查询</title>
<style>
/*存消息*/
.container {
	height:700px;
}
/*分页*/
.page {
}

.item {
	position:relative
	height:200px;
	/*background:#CCC;*/
}
.itemTitle {
	font-size:24px;
	height:40px;
	/*background:#06C;*/
}
#step {
	margin-bottom:10px;
	height:100px;
	float:left;
	/*background:#3F0;*/
}
.data {
	/*background-color:#F63;*/
	height:30px;
	display:inline;
	margin-left::20px;
}

a {
	text-decoration:none;
	color:#000;
}

</style>
</head>

<body>
<div class="container">
    <div class="item" >
     
    </div>
  </div>
</div>

</body>
<script type="text/javascript">
$(document).ready(function(){
     $.post("/ulms_project/repair/repair_search",function(data){ 
            console.log(data);          
            var repiar_list = data.list;
           
            for(var i=0;i<repiar_list.length;i++)
            {
                var repair_order  =repiar_list[i].repair_order;
                var user        = repiar_list[i].user;
               
                var content = "<div class=\"item\">"+"<div class=\"itemTitle\"> <a target=\"_blank\" href=\"\">报修"+(i+1)+"</a></div>";
                var body    = "<div style=\"margin-top:20px;\"><div class=\"data\"> &nbsp;&nbsp;报修时间："+repair_order.created+"</div><span style=\"margin-left:30px\">报修人:"+user.name+"</span>";
                var button  = "";
               if(repair_order.Auditing_status==0 && repair_order.arrangement_status==0)
               {
                   button  = "<span style=\"float:right;margin-right:100px\"><button type=\"button\" onclick=\"order_cancel(this)\" class=\"btn btn-default\" data-item-id=\""+repair_order.id+"\">取消报修</button></span>";
               }else if(repair_order.order_status==1)
               {
                   button  = "<span style=\"float:right;margin-right:100px\"><button type=\"button\" onclick=\"order_suggestion(this)\" class=\"btn btn-default\" data-item-id=\""+repair_order.id+"\">立即评价</button></span>";
               }             
                var last =    "</div> </div>";              
                $(".container").append(content+body+button+last);
            }
      
     });
});

function order_cancel(button)
{
    var order_id =$(button).attr("data-item-id");
     $.post("/ulms_project/repair/repair_cancel",{order_id:order_id},function(data){ 
        var is_success = data.is_success;
        if(is_success ==true)
        {
             alert("订单取消成功");
             location.reload();
        }
     });
}

function order_suggestion_sbumit(button)
{
     var order_id =$(button).attr("data-item-id");
     $.post("/ulms_project/repair/repair_suggestion",{order_id:order_id},function(data){ 
        var is_success = data.is_success;
        if(is_success ==true)
        {
             alert("订单取消成功");
             location.reload();
        }
     });
}

</script>
</html>
